<template>
  <div class="home-banner">
    <!-- 使用轮播图组件  渲染 -->
    <XtxSlider :sliders="sliders" :auto-play="true"></XtxSlider>
  </div>
</template>

<script>
import { ref } from 'vue'
import { findBanner } from '@/api/home.js'
export default {
  name: 'HomeBanner',
  setup() {
    const sliders = ref([])
    // 写后台数据代码
    async function loadSlider() {
      const res = await findBanner()
      return (sliders.value = res.result)
    }
    loadSlider()
    return {
      sliders
    }
  }
}
</script>

<style scoped lang="less">
.home-banner {
  width: 1240px;
  height: 500px;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 98;
}
</style>
